package com.oha.laporrayelchurro.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.log4j.Logger;

public class H2BaseDao {
	
	private static Logger log4j = Logger.getLogger(H2BaseDao.class);

	   
    /**
     * Cierra una conexion.
     * @param conn
     */
    protected void close(PreparedStatement pstm){
        if(pstm!=null){
            try{
                pstm.close();
            }catch(SQLException sqle){
                log4j.error("closeConnection.SQLException", sqle);
            }
            pstm = null;
        }
    }
    
    /**
     * Cierra un result set.
     * @param conn
     */
    protected void close(ResultSet rs){
        if(rs!=null){
            try{
                rs.close();
            }catch(SQLException sqle){
                log4j.error("closeConnection.SQLException", sqle);
            }
            rs = null;
        }
    }
    
    /**
     * Cierra una conexion.
     * @param conn
     */
    protected void close(Connection conn){
        if(conn!=null){
            try{
                conn.close();
            }catch(SQLException sqle){
                log4j.error("closeConnection.SQLException", sqle);
            }
            conn = null;
        }
    }
	
}
